﻿using System.IO;
using UnityEditor;
using UnityEngine;

public class FormatSprite
{
    [MenuItem("Assets/Mini Tools/Texture/修改Sprite格式", false, 412)]
    private static void Main()
    {
        EditorUtils.ForeachTexture(ProcessTexture);

        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();

        Debug.Log("处理完成");
    }

    private static void ProcessTexture(TextureImporter importer, string path)
    {
        Debug.Log(path);

        var sprites = AssetDatabase.LoadAllAssetsAtPath(path);
        Debug.Log($"sprites.count = {sprites.Length}");
        //for (int i = 0; i < sprites.Length; i++)
        //{
        //    var sprite = sprites[i];
        //    if (i < nums.Length)
        //    {
        //        sprite.name = nums[i].ToString();
        //    }
        //}
        foreach (var sprite in sprites)
        {
            Debug.Log(sprite.name);
        }
    }
}
